package com.testcase;

public class SensorNames {

	private String title;
	private String fullTitle;
	private String bothTitles;
	
	public SensorNames(String sensorName) {
		this.bothTitles = sensorName;
		this.title = this.parseTitle();
		this.fullTitle = this.parseFullTitle();
	}
	
	public String getBothTitles() {
		return this.bothTitles;
	}
	
	public String getFullTitle() {
		return this.fullTitle;
	}
	
	public String getTitle() {
		return this.title;
	}
	
	//Get the Name
	private String parseTitle() {
		String senText = this.bothTitles;
		int first = bothTitles.lastIndexOf("(");
		int last = bothTitles.lastIndexOf(")");
		String titleOnly = senText.substring(first+1, last);
		titleOnly = titleOnly.replaceAll(" ", "");
		return titleOnly;
	}
	
	//Get the Full Name
	private String parseFullTitle() {
		int index = this.bothTitles.lastIndexOf("(");
		String fullTitleOnly = this.bothTitles.substring(0, index - 1);
		return fullTitleOnly;
	}
}